<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib  uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath()+request.getServletPath().substring(0,request.getServletPath().lastIndexOf("/")+1);
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path;
%>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>${article.title }</title>
</head>
<script type="text/javascript" src="<%=basePath%>js/jquery-1.8.2.min.js"></script>
<script type="text/javascript">

	$(document).ready(function(){
		$("#back").click(function(){
			window.location.href="<%=basePath%>article/list";
		});
	});
	function page(currentPage){
		$("#pageNumber").val(currentPage);
		$("#searchForm").submit();
	}
</script>
<body>
<div style="height:300px;wight:1px;"></div>
	<div align="center">
		${article.content }
	</div>
	<form action="<%=basePath%>article/detail" name="searchForm" id="searchForm" method="post">
		<input type="hidden" name="pageNumber" value="1" id="pageNumber"/>
		<input type="hidden" name="pageSize" value="15" />
	</form>
	<table border="0" cellpadding="4" cellspacing="4" width="100%" align="center">
			<c:forEach items="${page.list}" var="reply" varStatus="status">
				<tr>
					<td align="center">${reply.author }</td>
					<td align="center">${reply.content }</td>
					<td align="center">${reply.reply_date }</td>
					<td align="center">${reply.floor }</td>
				</tr>
			</c:forEach>
			<tr><td colspan="8"></td></tr>
			<tr><td colspan="8" align="center">
			<c:choose>
				<c:when test="${page.pageNumber >1 }"><a href="#" onclick="page(${page.pageNumber-1})">上一页</a></c:when>
				<c:otherwise>
				</c:otherwise>
			</c:choose>
			<c:choose>
				<c:when test="${page.pageNumber <page.totalPage}"><a href="#" onclick="page(${page.pageNumber+1})">下一页</a></c:when>
				<c:otherwise></c:otherwise>
			</c:choose>
			当前第${page.pageNumber }页,共${page.totalPage}页,${page.totalRow }条记录。</td></tr>
			<%-- <c:if test="${username != 'admin'}"><tr><td colspan="5" align="center"><c:if test="${page.totalRow <50 }">你还有<font color="red">${50-page.totalRow }</font>个电话任务未完成，加油喔。</c:if></td></tr></c:if> --%>
		</table>
	<hr>
	<form action="<%=basePath %>reply/save" method="post">
		<input type="hidden" name="article_id" id="article_id" value="${article.id }" />
		<input type="hidden" name="author" id="author" value="${user.username }" />
		<table align="center" cellpadding="4" cellspacing="4">
			<tr><td align="right">标题：</td><td><input type="text" size="80" disabled name="title" value="${article.title }" /></td></tr>
			<tr><td align="right" valign="top">内容：</td><td><textarea cols="70" rows="5" name="content" id="content"></textarea></td></tr>
			<tr><td colspan="2" align="center"><input type="submit" value="回帖">&nbsp;&nbsp;<input type="button" value="返回列表" id="back" /></td></tr>
		</table>
	</form>
</body>
</html>